$(document).ready(function(){
	$("#proNum").change(function(){		
		var pro = document.getElementById("proNum");
		var index = pro.options[pro.selectedIndex].value;
		if(index=="CN"){
			var cit = document.getElementById("cityNum");	
			document.getElementById("cityNum").options.length = 1;
			document.getElementById("areNum").options.length = 1;
			document.getElementById("section").options.length=1;
			$.post("../customerJson!returnCountryCode.action",{"name":this.value},function(data){
				$(data.provinces).each(function(){							
					cit.options.add(new Option(this.clinentProvinceName,this.clinentProvinceNumber));
				});
			});
		}else{
			document.getElementById("cityNum").options.length = 1;
			document.getElementById("areNum").options.length = 1;
			document.getElementById("section").options.length=1;
		}
	});
	$("#cityNum").change(function(){
		var c = document.getElementById("areNum");
		if(this.value != -1){
			c.options.length = 1;
			document.getElementById("areNum").options.length = 1;
			document.getElementById("section").options.length = 1;
			$.post("../whitherJson!findCitys.action",{"proNumber":this.value},function(data){
				$(data.citys).each(function(){
					c.options.add(new Option(this.clinentCityName,this.clinentCityNumber));
				});
			});
		}else{
			cit.options.length = 1;
			document.getElementById("areNum").options.length = 1;
			document.getElementById("section").options.length = 1;
		}
	});
	$("#areNum").change(function(){
		var s = document.getElementById("section");
		if(this.value != -1){
			s.options.length = 1;
			$.post("../whitherJson!findAreas.action",{"cityNumber":this.value},function(data){
				$(data.areas).each(function(){
					s.options.add(new Option(this.clinentAreaName,this.clinentAreaNumber));
				});
			});
		}else{
			c.options.length = 1;
		}
	});
	
});